<?php
//
// Page Creator
// By Garry Conn
// Version 1.10.03.2012.2033
//
if($_POST['url']!=''){
$title = htmlspecialchars($_POST['title'], ENT_QUOTES);
$url = preg_replace( array('/[^a-z0-9]+/','/^-|-$/'), // from array
              array('-',''),                   // to array
              strtolower($title));  
$url = date('m-d-Y-Hi')//.substr($url,0,25)
;
$commentform = htmlspecialchars($_POST['commentform'], ENT_QUOTES);
$authorname = htmlspecialchars($_POST['authorname'], ENT_QUOTES);
$authorurl = htmlspecialchars($_POST['authorurl'], ENT_QUOTES);
$pagedate = htmlspecialchars($_POST['pagedate'], ENT_QUOTES);
$metadescription = htmlspecialchars($_POST['metadescription'], ENT_QUOTES);
$content = $_POST['content'];
$serverurl = $_SERVER['SERVER_NAME'];
$body ='<?php
$title = \''.$title.'\';
$url = \''.$url.'\';
$pagedate = \''.$pagedate.'\';
$serverurl = \''.$serverurl.'\';
$metadescription = \''.$metadescription.'\';
$authorname = \''.$authorname.'\';
$authorurl = \''.$authorurl.'\';
$commentform = \''.$commentform.'\';
include(\'connpress/templates/page-top.php\');
// PAGE CONTENT GOES BELOW THIS LINE ?>
'
.$content.
'
<?php // PAGE CONTENT ENDS ABOVE THIS LINE
include(\'connpress/templates/page-bottom.php\');?>';


$fh = fopen($url.'.php' , "w") or die("can't open file");
fwrite($fh,$body);
fclose($fh);
include('connpress/page-created-success-message.php');
include('connpress/sitemap-xml-writer.php');
include('connpress/rss-feed-writer.php');
include('connpress/add-entry-to-homepage.php');
include('connpress/add-entry-to-sidebar.php');
}
?>
